<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var box = document.createElement('input'); // 默认文本框
        document.body.appendChild(box);
        box.type = 'text';
        box.value = 'admin';
        box.disabled = true; // 禁用
        box.setAttribute('readonly','readonly'); // 只读
        box.removeAttribute('readonly');
        box.disabled = false;
    </script>
</body>
</html>